module Aio::Ui

	class ReadableText

		DefaultIndent	= 2

		class << self
			
			def dump_module_cmds(mods, h=nil, indent=DefaultIndent)
				col = ["cmd name", "ranking", "device", "description"]
				table = Aio::Base::Toolkit::Table.new(
					'Header'	=> h ||= 'Aio CMD Modules',
					'Indent'	=> indent,
					'Columns'	=> col,
					'CellPad'	=> 2,
					'SortIndex'	=> 2)

				# info => { :module_type,
				# 					:module_layer_2
				#						:full_path
				#    				:klass
				mods.each_pair do |mod_name, info|
					row = []
					row << info[:klass].cmd_full
					row << info[:klass].ranking.to_s
					row << info[:module_layer_2]
					row << info[:klass].description
					table << row
				end

				table.to_s + "\n"
			end

			def dump_module_inputs(mods, h=nil, indent=DefaultIndent)
				col = ["input style", "platform", "description"]
				table = Aio::Base::Toolkit::Table.new(
					'Header'		=> h || "Aio Input Modules",
					'Indent'		=> indent,
					'Columns'		=> col,
					'CellPad'		=> 2)

				mods.each_pair do |mod_name, info|
					row = []
					row << mod_name
					row << info[:klass].platform
					row << info[:klass].description
					table << row
				end

				table.to_s + "\n"
			end

			def dump_module_outputs(mods, h=nil, indent=DefaultIndent)
				col = ["output style", "suffix", "description"]
				table = Aio::Base::Toolkit::Table.new(
					'Header'		=> h || "Aio Output Modules",
					'Indent'		=> indent,
					'Columns'		=> col,
					'CellPad'		=> 2)

				mods.each_pair do |mod_name, info|
					row = []
					row << mod_name
					row << info[:klass].file_suffix
					row << info[:klass].description
					table << row
				end

				table.to_s + "\n"
			end
						
			
		end # self
	end
end
